package il.ac.braude.sona.IcmUnitTest;

import java.util.ArrayList;

import il.ac.braude.sona.constants.TestingParamKit;
import il.ac.braude.sona.control.ReportsController;
import junit.framework.Assert;
import junit.framework.TestCase;

public class ActiveStdUnitTest extends TestCase {
	private ReportsController reportController = new ReportsController();
	private TestingParamKit myKit;

	protected void setUp() throws Exception {
		myKit=TestingParamKit.getTestingKit();
	}

	public void testStandardDeviationPerWeek() {
		StatisticsFromData data;
		ArrayList<Object> values = new ArrayList<Object>();
		values.add("Periodic Report");
		values.add("2013-06-16");
		values.add("2013-06-23");
		values.add("Previous Periodic Reports");
		reportController.selectReport();
		reportController.execReportInfo((String) values.get(0), values);
		myKit.waitForNotify();
		// reportController.frame.stac_active.getStdDev()==
		data = new StatisticsFromData(reportController.frame.activeResults);
		Assert.assertTrue(data.checkStd(reportController.frame.stac_active.getStdDev()));
		Assert.assertFalse(data.checkStd(reportController.frame.stac_active.getMean()));
	}

	public void testStandardDeviationPerMonth() {
		StatisticsFromData data;
		ArrayList<Object> values = new ArrayList<Object>();
		values.add("Periodic Report");
		values.add("2013-05-24");
		values.add("2013-06-23");
		values.add("Previous Periodic Reports");
		reportController.selectReport();
		reportController.execReportInfo((String) values.get(0), values);
		myKit.waitForNotify();
		data = new StatisticsFromData(reportController.frame.activeResults);
		Assert.assertTrue(data.checkStd(reportController.frame.stac_active.getStdDev()));
		Assert.assertFalse(data.checkStd(reportController.frame.stac_active.getMean()));
	}

	public void testStandardDeviationPer_3_Monthes() {
		StatisticsFromData data;
		ArrayList<Object> values = new ArrayList<Object>();
		values.add("Periodic Report");
		values.add("2013-03-28");
		values.add("2013-06-27");
		values.add("Previous Periodic Reports");
		reportController.selectReport();
		reportController.execReportInfo((String) values.get(0), values);
		myKit.waitForNotify();
		data = new StatisticsFromData(reportController.frame.activeResults);
		Assert.assertTrue(data.checkStd(reportController.frame.stac_active.getStdDev()));
		Assert.assertFalse(data.checkStd(reportController.frame.stac_active.getMean()));
	}
	public void testStandardDeviationPer_6_Monthes() {
		StatisticsFromData data;
		ArrayList<Object> values = new ArrayList<Object>();
		values.add("Periodic Report");
		values.add("2012-12-07");
		values.add("2013-06-07");
		values.add("Previous Periodic Reports");
		reportController.selectReport();
		reportController.execReportInfo((String) values.get(0), values);
		myKit.waitForNotify();
		data = new StatisticsFromData(reportController.frame.activeResults);
		Assert.assertTrue(data.checkStd(reportController.frame.stac_active.getStdDev()));
		Assert.assertFalse(data.checkStd(reportController.frame.stac_active.getMean()));
	}

}
